   set legacy 0.99
   set tv ntsc
   set romsize 4k


   player0:
 %00011000
 %11111111
 %11111111
 %00111100
 %00111100
 %00011000
 %00011000
 %00011000	
end

   sdata mymusic=a
   1,2,3,4,5,6,7,255
end

   data playlengths
   31
end

   data play1
   225,72,90,114,
   160,0,0,80,
   160,0,0,80,
   164,0,0,80,
   172,0,0,80,
   160,0,0,80,
   168,0,0,80,
   172,0,0,80,
   160,0,0,80,
   172,0,0,80,
   160,0,0,80,
   232,0,0,112,
   160,0,0,80,
   160,0,0,80,
   160,0,0,80,
   160,128,192,80,
   160,0,0,80,
   160,128,128,80,
   160,0,0,80,
   160,128,0,80,
   160,0,0,80,
   224,0,0,112,
   160,0,0,80,
   160,0,0,80,
   160,0,0,80,
   160,0,0,87,
   160,0,0,80,
   160,0,0,80,
   160,0,0,80,
   160,0,0,83,
   160,0,0,80,
   160,0,0,80
end

 playfield:
 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 X..............................X
 X...XXXXX.XXX.XXXXX.X....XXXX..X
 X.....X....X....X...X....X.....X
 X.....X....X....X...X....X.....X
 X.....X....X....X...X....XXX...X
 X.....X....X....X...X....X.....X
 X.....X....X....X...X....X.....X
 X.....X...XXX...X...XXXX.XXXX..X
 X..............................X
 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
end

title
 COLUBK = $06
 COLUPF = $76
 drawscreen
 if joy0fire then goto skiptitle
 goto title
 
skiptitle
 playfield:
 X.X.........................X.X
 X.X.........................X.X
 X.X..X......................X.X
 X.X.XX......................X.X
 X.X.........................X.X
 X.X.X.......................X.X
 X.X.XX......................X.X
 X.X.........................X.X
 X.X.XX......................X.X
 X.X.........................X.X
 XXX.X.......................XXX
 
end


   rem Flip between -1 and 1
   rem Start out with  a = 255  or  a = 1
   rem Use the following to flip between the two values:
   rem a = a ^ 254

init
   a = 1
   score = 0
   scback = $A8
   player0x = 100
   player0y = 85
   dim scback = $A4
   COLUP0 = $74
   COLUPF = $A8
   scorecolor = 10
   dim scrollline = s
   scrollline = 11
   goto Main

Main
   COLUBK = $A2
   
   if switchreset then init
   PF0=%10000000

   
   t = sread(mymusic)
checkfire
   if missile0y>240 then goto skip
   missile0y = missile0y - 1 : goto draw

skip
   if joy0fire then missile0y=player0y-2:missile0x=player0x+4

draw   
   drawscreen
   if player0x > 160 then player0x = 159
   if player0x < 1 then player0x = 1
   
   if joy0up then gosub playmove
   
   missile0height = 7
   
   if joy0fire then missile0y=player0y:missile0x=player0x+(9/2)
   
   if joy0up && !collision(player0,playfield) then m = 1 : goto skipmove
   if joy0left  && !collision(player0,playfield) then player0x = player0x - 1 :  REFP0 = 8 : m = 2 : goto skipmove
   if joy0right  && !collision(player0,playfield) then player0x = player0x + 1 :  m = 4 : REFP0 = 0 : goto skipmove


   
   goto Main

  
skipmove
   goto Main

   asm
minikernel
   sta WSYNC
   lda scback
   sta COLUBK
   rts
end

playmove
   i=4*(playlengths[0]-scrollline)
   var44=play1[i]
   i=i+1
   var45=play1[i]
   i=i+1
   var46=play1[i]
   i=i+1
   var47=play1[i]
   pfscroll down
   scrollline=scrollline+1 
   if scrolline > playlengths[0] then scrollline = 0
return
